<script type="text/javascript" src="{URL_JS}product.js"></script>
<script language="javascript" >
function showFilterOnLoadPage(divID){
	document.getElementById(divID).style.display = "block" ;
	}
showFilterOnLoadPage("my_filter_block");
function export_csv()
{
	var frm = document.frmUpdate;
	var checked=false;
	try{
		if(document.getElementById('productSelected').checked==true){
			checked=true;
		}
		else{
			for(var i=0;i<frm.productSelected.length;i++){
				if(frm.productSelected[i].checked==true){
					checked=true;
					break;
				}
			}
		}
		if(checked==false){
			alert("商品を選択して下さい。");
			return ;
		}
	}
	catch(e){
		alert(e.toString());
	}
	
	var name = "";
	while(name == ""){
		name = prompt("ファイル名を入力して下さい。(半角英数 通常は auctions )");
	}

	var from_date=document.getElementById('fromDate').value;
	var to_date=document.getElementById('toDate').value;
	var filter_cat=document.getElementById('category').value;
	document.frmUpdate.sAction.value = 'export_csv';
	document.frmUpdate.action="{URL_SITE}?sMod=product_index&sAction=export_csv&fromDate="+from_date+"&toDate="+to_date+"&category="+filter_cat+"&filename="+name
	document.frmUpdate.submit();
}
function ChangeSelectAll(){
	var frm= document.frmUpdate;
	if(frm.selectAll.checked==true){
    	document.getElementById('productSelected').checked=true;
		for(var i=0;i<frm.productSelected.length;i++){
			frm.productSelected[i].checked="checked";
		}
		
	}
	else{
		document.getElementById('productSelected').checked="";
		for(var i=0;i<frm.productSelected.length;i++){
			frm.productSelected[i].checked="";
		}
	}
}
function delete_products(){
	var frm= document.frmUpdate;
	var checked=false;
	if(document.getElementById('productSelected').checked==true){
		checked=true;
	}
	for(var i=0;i<frm.productSelected.length;i++){
		if(frm.productSelected[i].checked==true){
			checked=true;
			break;
		}
	}
	if(checked==false){
		alert("Please choice products that you want to delete");
		return ;
	}
	if(confirm('are you sure to delete products?')==1){
		document.frmUpdate.target="";
		document.frmUpdate.sAction.value =  'delete_products';
		document.frmUpdate.action="?sMod=product_index";
		document.frmUpdate.submit();
	}
}
function doUpdateProducts(){
    document.frmUpdate.target = '_self';
	document.frmUpdate.sAction.value =  'update_status';
    document.frmUpdate.submit();
    
}
function changeShopOwner(){
    redir("?sMod=product_index&user_id=" + document.getElementById("shop_owner_id").value);
}
</script>
<div class="top_list_page"></div>
<form name="frmUpdate" id="frmUpdate" action="" method="post" enctype="multipart/form-data" >
  <input type="hidden" name="sAction" value="update_status" />
  <table width="120%" class="adminlist">
    <thead>
      <tr>
        <th align="center" scope="col"><input type="checkbox" name="selectAll" value="1" onclick="ChangeSelectAll()"></th>
        <th align="center" valign="middle" scope="col">画像</th>
        <th align="center" valign="middle" title="Price Fasteners" scope="col">情報</th>
      </tr>
    </thead>
    <tbody id="listProduct" >
      <!-- BEGIN:LIST_PRODUCT -->
      <!-- BEGIN:rowProduct -->
      <tr class="td_main {rowProduct.product_name}" {rowProduct.stylesheet} >
        <td height="88" valign="middle"><input type="checkbox" name="productSelected[]" id="productSelected" value="{rowProduct.product_id}" />
        <input type="hidden" name="productID[]" value="{rowProduct.id}" /></td>
        <td valign="top" align="center"><img src="{rowProduct.product_thumb}" alt="{rowProduct.id}" width="120" height="80" /></td>
        <td align="right" valign="top"><table width="70%" class="adminlist noboder">
          <thead>
            </thead>
          <tbody id="listProduct2" >
            <tr align="left" class="{rowProduct.product_name}" {rowProduct.stylesheet} >
              <td width="30" valign="middle" nowrap="nowrap">{rowProduct.product_id}</td>
              <td width="40" valign="middle" nowrap="nowrap">
              	<input name="product_key[{rowProduct.id}]" type="text" id="product_key[{rowProduct.id}]" value="{rowProduct.product_key}" size="5" maxlength="10" />
                <input name="product_key_select[{rowProduct.id}]" type="hidden" id="product_key_select[{rowProduct.id}]" value="{rowProduct.product_key_select}" />
              </td>
              <td width="64" valign="middle" nowrap="nowrap"><input name="product_store[{rowProduct.id}]" type="text" id="product_store[{rowProduct.id}]" value="{rowProduct.product_store}" size="5" maxlength="10" /></td>
              <td width="121" valign="middle" nowrap="nowrap"><input name="product_title[{rowProduct.id}]" type="text" id="product_title[{rowProduct.id}]" value="{rowProduct.product_title}" size="20" maxlength="50" /></td>
              <td width="122" valign="middle" nowrap="nowrap"><input name="product_prices_start[{rowProduct.id}]" type="text" id="product_prices_start[{rowProduct.id}]" value="{rowProduct.product_prices_start}" size="10" maxlength="10" />
                円 開始</td>
              <td width="122" valign="middle" nowrap="nowrap"><input name="product_price_fastener[{rowProduct.id}]" type="text" id="product_price_fastener[{rowProduct.id}]" value="{rowProduct.product_price_fastener}" size="10" maxlength="10" />
                円 終了</td>
              <td width="157" valign="middle" nowrap="nowrap"><input name="Product.product_price_fastener" type="text" id="Product.product_price_fastener" value="{rowProduct.product_price_fastener}" size="10" maxlength="10" />
                円 即決</td>
              </tr>
          </tbody>
        </table>
          <table width="99%" class="adminlist noboder">
            <thead>
            </thead>
            <tbody id="listProduct3" >
              <tr class="{rowProduct.product_name}" {rowProduct.stylesheet} >
                <td width="36" align="left" valign="middle" nowrap="nowrap"><input name="product_qty[{rowProduct.id}]" type="text" id="product_qty[{rowProduct.id}]" value="{rowProduct.product_qty}" size="2" maxlength="1" />
                個</td>
                <td width="130" align="left" valign="middle" nowrap="nowrap"><input name="product_time_auction[{rowProduct.id}]" type="text" id="product_time_auction[{rowProduct.id}]" value="{rowProduct.product_time_auction}" size="2" maxlength="1" />
                オークション期間</td>
                <td width="79" align="left" valign="middle" nowrap="nowrap"><input name="product_time_auction_end[{rowProduct.id}]" type="text" id="product_time_auction_end[{rowProduct.id}]" value="{rowProduct.product_time_auction_end}" size="2" maxlength="1" />
終了時間</td>
                <td width="42" height="31" align="left" valign="middle" nowrap="nowrap"><img src="{URL_TEMPLATE_ADMIN}image/icon/pre.gif" width="32" height="16" />                  <input type="checkbox" name="product_store_hot_auction[{rowProduct.id}]" value="1" {rowProduct.product_store_hot_auction_checked} /></td>
                 <td width="42" height="31" align="left" valign="middle" nowrap="nowrap"><img src="{URL_TEMPLATE_ADMIN}image/icon/hot.gif" width="32" height="16" />                   <input type="checkbox" name="product_icon_gift[{rowProduct.id}]" value="1" {rowProduct.product_icon_gift_checked} /></td>
                <td width="42" align="left" valign="middle" nowrap="nowrap"><img src="{URL_TEMPLATE_ADMIN}image/icon/bld.gif" width="32" height="16" />
                  <input type="checkbox" name="product_title_bold_line[{rowProduct.id}]" value="1" {rowProduct.product_title_bold_line_checked} /></td>
                <td width="42" align="left" valign="middle" nowrap="nowrap"><img src="{URL_TEMPLATE_ADMIN}image/icon/bgclr.gif" width="32" height="16" />
                  <input type="checkbox" name="product_bakground_color[{rowProduct.id}]" value="1" {rowProduct.product_bakground_color_checked} /></td>
                <td width="32" align="left" valign="middle" nowrap="nowrap"><a href="?sMod=product_index&sAction=edit_form&id={rowProduct.id}&page={page}"><img src="{URL_TEMPLATE_ADMIN}image/icon/edit.gif" title="{FORM.edit}" alt="{FORM.edit}" border="0" /></a></td>
                <td width="32" align="left" valign="middle" nowrap="nowrap"><a onclick="return confirmDelete();" href="?sMod=product_index&sAction=do_delete&id={rowProduct.id}"><img src="{URL_TEMPLATE_ADMIN}image/icon/del.gif" title="{FORM.delete}" alt="{FORM.delete}" border="0" /></a></td>
                <td width="323" align="left" valign="middle" nowrap="nowrap">&nbsp;</td>
              </tr>
            </tbody>
        </table></td>
      </tr>
      <!-- END:rowProduct -->
      <!-- END:LIST_PRODUCT -->
    </tbody>
    <tfoot>
      <tr>
        <td colspan="3">{navigator}</td>
      </tr>
    </tfoot>
  </table>
  <p>&nbsp;</p>
</form>
